import request from '@/utils/request'
// method 不写默认为 GET 请求
/**
 * 获取部门信息
 */
export const getDepartmentListAPI = () => {
  return request({
    url: '/company/department',
  })
}

/**
 * 获取员工基本信息
 */
export const getEmployeeSimpleListAPI = () => {
  return request({
    url: '/sys/user/simple',
  })
}

/**
 * 新增部门组织结构
 */
export const addDepartmentAPI = (data) => {
  return request({
    method: 'POST',
    url: '/company/department',
    // parmas:{} 里面的参数和值会出现在url?后面
    // data:{} 里面的参数名和值会出现在请求体body中
    data
  })
}

/**
 * 编辑获取部门组织结构信息
 */
export const useIdSelecteDepartmentInfoAPI = (DepId) => {
  return request({
    url: `/company/department/${DepId}`,
  })
}

/**
 * 修改部门组织结构信息
 */
export const useIdUpdateDepartmentInfoAPI = (dataobj) => {
  return request({
    method: 'PUT',
    url: `/company/department/${dataobj.id}`,
    data: dataobj
  })
}

/**
 * 删除部门组织结构信息
 */
export const useIdDeleteDepartmentInfoAPI = (DepId) => {
  return request({
    method: 'DELETE',
    url: `/company/department/${DepId}`,
  })
}
